package Eyjafjalla.power;

import Eyjafjalla.action.MakeTempCardInCloudAction;
import Eyjafjalla.card.status.Cloud_Eyjafjalla;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.localization.PowerStrings;

public class DenseMistPower extends AbstractEyjafjallaPower {
    public static final String POWER_ID = "eyjafjalla:DenseMistPower";
    private static final PowerStrings powerStrings;

    boolean isPlayer = false;

    public DenseMistPower(AbstractCreature owner, int amount){
        this.name = powerStrings.NAME;
        this.ID = POWER_ID;
        this.owner = owner;
        this.amount = amount;
        String path128 = "EyjafjallaResources/img/power/DenseMistPower_84.png";
        String path48 = "EyjafjallaResources/img/power/DenseMistPower_32.png";
        this.region128 = new TextureAtlas.AtlasRegion(ImageMaster.loadImage(path128),0,0,84,84);
        this.region48 = new TextureAtlas.AtlasRegion(ImageMaster.loadImage(path48),0,0,32,32);
        this.isTurnBased = true;
        this.type = PowerType.BUFF;
        this.enableExtraAmount = true;
        this.extraAmount = 2;
        this.updateDescription();
    }

    public void stackPower(int stackAmount) {
        super.stackPower(stackAmount);
        this.extraAmount+=2;
    }

    @Override
    public void wasHPLost(DamageInfo info, int damageAmount) {
        if(damageAmount>0){
            this.extraAmount+=this.amount;
            this.updateDescription();
        }
    }

    @Override
    public void atEndOfTurnPreEndTurnCards(boolean isPlayer) {
        this.flash();
        this.addToBot(new GainBlockAction(this.owner, this.owner, this.extraAmount));
    }

    @Override
    public void updateDescription() {
        this.description = powerStrings.DESCRIPTIONS[0] + this.extraAmount + powerStrings.DESCRIPTIONS[1] + this.amount + powerStrings.DESCRIPTIONS[2];
    }

    static {
        powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID);
    }
}



